package com.hilin.common.common;

import com.hilin.common.common.handler.RequestErrorHandler;
import com.hilin.common.common.handler.RequestTokenHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * 项目引入Spring-web才会加载该模块
 */
@ConditionalOnClass({
        org.springframework.web.SpringServletContainerInitializer.class
})
@EnableConfigurationProperties({
        HilinWebConfig.class
})
public class HilinWebAutoConfig {

    @Bean
    public RequestErrorHandler requestErrorHandler() {
        return new RequestErrorHandler();
    }

    @Bean
    public RequestTokenHandler requestTokenHandler() {
        return new RequestTokenHandler();
    }

}
